package com.qingke.oo;

public class MyRectangle {
	private MyPoint v1 =  new MyPoint();
	private MyPoint v2 =  new MyPoint();
	
	public MyRectangle(int x1,int y1,int x2,int y2){
		v1.setXY(x1, y1);
		v2.setXY(x2, y2);
	}
	
	public MyRectangle(MyPoint v1,MyPoint v2){
		this.v1 = v1;
		this.v2 = v2;
	}
	
	public double getPerimeter(){
		return Math.abs((v1.getX()-v2.getX()))*2+Math.abs((v1.getY()-v2.getY()))*2;
	}
	
	public double getDiagonal(){
		return v1.distance(v2);
	}
}
